package com.kurt.sistemas.vendas;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class hibernateUtil {
	
	private static final SessionFactory session = buildSessionFactory();

	
	private static final SessionFactory buildSessionFactory(){
		try{ 
			
			Configuration cfg = new Configuration();
			cfg.configure("Hibernate.cfg.xml");
			return cfg.buildSessionFactory();
		}catch(Throwable e){
			System.out.println("Ferrou tudo!\n" + e);
			throw new ExceptionInInitializerError();
			
		}
		
		
		
		
	}

	public static SessionFactory getSession() {
		return session;
	}
}
